<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增订单测试')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-orders-add">
            <h4 class="form-header h4">订单测试信息</h4>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">订单号：</label>
                <div class="col-sm-8">
                    <input name="OrderNum" class="form-control" type="text" required>
                </div>
            </div>
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">订单类型(1:售货机，2:充电桩，3:微重力自取柜)：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="OrderType" class="form-control m-b" required>-->
<!--                        <option value="">所有</option>-->
<!--                    </select>-->
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">用户openId：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="OpenId" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">设备编号：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="DeviceNum" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">渠道商ID：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="DistributorId" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">代理商ID：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="AgentId" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">收款账户类型 1/2/3  平台/渠道商/代理商：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="ReceiptAccountType" class="form-control m-b" required>-->
<!--                        <option value="">所有</option>-->
<!--                    </select>-->
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">清算的代理商Id：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="ClearAgentId" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">用户昵称：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="UserMobile" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">用户交易流水号：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="UserTransactionUid" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">支付单号：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="OutTradeNo" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">总价：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="TotalAmount" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">支付方式 0未支付 1微信支付 2支付宝支付 3会员支付 4零元购：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="PayType" class="form-control m-b" required>-->
<!--                        <option value="">所有</option>-->
<!--                    </select>-->
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">支付状态 2未支付 1已支付：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <div class="radio-box">-->
<!--                        <input type="radio" name="PayStatus" value="" required>-->
<!--                        <label th:for="PayStatus" th:text="未知"></label>-->
<!--                    </div>-->
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">是否已清算 2未清算1已清算：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="IsClear" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">退款状态 2未退款 1线上已退款 3线下退款：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <div class="radio-box">-->
<!--                        <input type="radio" name="RefundStatus" value="">-->
<!--                        <label th:for="RefundStatus" th:text="未知"></label>-->
<!--                    </div>-->
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">订单状态 1正常 2异常 3网络拥堵 4确定没收到出货指令 5数据丢失：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <div class="radio-box">-->
<!--                        <input type="radio" name="Status" value="" required>-->
<!--                        <label th:for="Status" th:text="未知"></label>-->
<!--                    </div>-->
<!--                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">支付时间：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <div class="input-group date">-->
<!--                        <input name="PayDatetime" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
<!--                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">订单创建时间：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <div class="input-group date">-->
<!--                        <input name="AddDatetime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>-->
<!--                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">设备id：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="DeviceId" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label is-required">订单利润：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="profit" class="form-control" type="text" required>-->
<!--                </div>-->
<!--            </div>-->
<!--            <h4 class="form-header h4">终端列表信息</h4>-->
<!--            <div class="row">-->
<!--                <div class="col-sm-12">-->
<!--                    <button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>-->
<!--                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>-->
<!--                    <div class="col-sm-12 select-table table-striped">-->
<!--                        <table id="bootstrap-table"></table>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/orders"
        $("#form-orders-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-orders-add').serialize());
            }
        }

        $("input[name='PayDatetime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='AddDatetime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(function() {
            var options = {
                pagination: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                sidePagination: "client",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'index',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                    	return columnIndex + $.table.serialNumber(index);
                    }
                },
                {
                    field: 'DeviceNum',
                    align: 'center',
                    title: '设备号',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].DeviceNum' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'DeviceName',
                    align: 'center',
                    title: '设备名称',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].DeviceName' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'SimCode',
                    align: 'center',
                    title: 'SIM卡码',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].SimCode' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'SensorCount',
                    align: 'center',
                    title: '货道数量',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].SensorCount' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'Disabled',
                    align: 'center',
                    title: '设备是否禁用 1启用 &2代理商禁用 &3 渠道商禁用 &4 超管禁用',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].Disabled' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'DistributorId',
                    align: 'center',
                    title: '渠道商id',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].DistributorId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'AgentId',
                    align: 'center',
                    title: '代理商id',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].AgentId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'AddDatetime',
                    align: 'center',
                    title: '添加时间',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].AddDatetime' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'OverDatetime',
                    align: 'center',
                    title: '过期时间',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].OverDatetime' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'AnnualFee',
                    align: 'center',
                    title: '服务费',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].AnnualFee' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'DeviceTypeId',
                    align: 'center',
                    title: '设备类型(1:自助售货机，2:充电桩，3:售纸机)',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].DeviceTypeId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'IsDeleted',
                    align: 'center',
                    title: '是否删除 1/2 是/否',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].IsDeleted' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'ReplenishmentClerksId',
                    align: 'center',
                    title: '补货员Id',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].ReplenishmentClerksId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'PartnersId',
                    align: 'center',
                    title: '合作伙伴Id',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].PartnersId' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'RenewalTime',
                    align: 'center',
                    title: '续费时间 单位 月',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].RenewalTime' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'IsOnline',
                    align: 'center',
                    title: '设备是否在线 0否 1是',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].IsOnline' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'HeartBeatState',
                    align: 'center',
                    title: '网络是否正常 0否 1是',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].HeartBeatState' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'LastHeartBeat',
                    align: 'center',
                    title: 'null',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].LastHeartBeat' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'ShoppingCar',
                    align: 'center',
                    title: '购物车:0购买单个/1是多个/2是全部/',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].ShoppingCar' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'OpenSignalMonitor',
                    align: 'center',
                    title: '是否开启信号检测1/2 是/否',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].OpenSignalMonitor' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'HandOrdernum',
                    align: 'center',
                    title: '正在处理的订单号。当服务关闭时，如果设备空闲，此处为空字符串；如果设备正在交易，此处为对应订单号。服务开启后，首次查询此处，更新设备交易状态。',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].HandOrdernum' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'AgentQueryTrade',
                    align: 'center',
                    title: '是否交由服务代理查询交易状态 0否 1是',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].AgentQueryTrade' value='%s'>", index, value);
                        return html;
                    }
                },
                {
                    field: 'IsSelf',
                    align: 'center',
                    title: '是否开启自检',
                    formatter: function(value, row, index) {
                        var html = $.common.sprintf("<input class='form-control' type='text' name='devicesList[%s].IsSelf' value='%s'>", index, value);
                        return html;
                    }
                
                }]
            };
            $.table.init(options);
        });

        function addColumn() {
            var count = $("#" + table.options.id).bootstrapTable('getData').length;
            sub.editColumn();
        	
            $("#" + table.options.id).bootstrapTable('insertRow', {
                index: count,
                row: {
                    index: $.table.serialNumber(count),
                    DeviceNum: "",
                    DeviceName: "",
                    SimCode: "",
                    SensorCount: "",
                    Disabled: "",
                    DistributorId: "",
                    AgentId: "",
                    AddDatetime: "",
                    OverDatetime: "",
                    AnnualFee: "",
                    DeviceTypeId: "",
                    IsDeleted: "",
                    ReplenishmentClerksId: "",
                    PartnersId: "",
                    RenewalTime: "",
                    IsOnline: "",
                    HeartBeatState: "",
                    LastHeartBeat: "",
                    ShoppingCar: "",
                    OpenSignalMonitor: "",
                    HandOrdernum: "",
                    AgentQueryTrade: "",
                    IsSelf: ""
                }
            });
        }
    </script>
</body>
</html>